<?php


namespace App\Services\Game;


use App\DTOS\Admin\FileInforDTO;
use App\DTOS\Admin\MemberDTO;
use App\Models\Game\ClinetFileRecord;
use App\Models\Game\Member;
use App\Utils\MyLog;

class ClinetFileService
{
    /**
     * @param FileInforDTO $DTO
     * @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
     */
    public function paginate(FileInforDTO $DTO){

        $model = ClinetFileRecord::query();
        $perPage = $DTO->getLimit();
        $page = $DTO->getPage();
        $id = $DTO->getId();
        $gid = $DTO->getGid();
        $gname = $DTO->getGname();
        $package_no = $DTO->getPackageNo();

        if ($id){
            $model->where('id',$id);
        }
        if ($gid){
            $model->where('gid',$gid);
        }
        if ($gname){
            $model->where('gname',$gname);
        }
        if ($package_no){
            $model->where('package_no','like',"%$package_no%");
        }

        return $model->orderByDesc('id')->paginate($perPage,'*','page',$page);
    }
}
